PixelCache: Ensure clean cairo_t state in draw
authorAlexander Larsson <alexl@redhat.com>
Wed, 8 Jan 2014 09:44:32 +0000 (10:44 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 8 Jan 2014 09:48:56 +0000 (10:48 +0100)
This adds save/restore calls to the clear-to-transparent call in
the pixel cache, to avoid changing the default color of the
cairo_t. It also removes a call set_operator call that is no longer
necessary (it was trying to manually restore the state).

https://bugzilla.gnome.org/show_bug.cgi?id=721480

gtk/gtkpixelcache.c

index 411a75e7c324ce16ad2d3c2fa8bee6e872ce508d..71c78330d838feb735f630cbc65be7d1f5fcef6e 100644 (file)
@@ -340,12 +340,13 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache,
       cairo_translate (backing_cr,
                       -cache->surface_x - canvas_rect->x - view_rect->x,
                       -cache->surface_y - canvas_rect->y - view_rect->y);
+
+      cairo_save (backing_cr);
       cairo_set_source_rgba (backing_cr,
                             0.0, 0, 0, 0.0);
       cairo_set_operator (backing_cr, CAIRO_OPERATOR_SOURCE);
       cairo_paint (backing_cr);
-
-      cairo_set_operator (backing_cr, CAIRO_OPERATOR_OVER);
+      cairo_restore (backing_cr);
 
       cairo_save (backing_cr);
       draw (backing_cr, user_data);